package com.tianqu.tms.dao;

import java.util.ArrayList;
import java.util.List;

import com.tianqu.tms.core.exception.TmsDaoException;
import com.tianqu.tms.dto.MemberDto;
import com.tianqu.tms.dto.MemberRentalLocationInfo;

/**
 * 会员DAO
 * 
 * @author tianshifu
 *
 */
public interface MemberDao {
	
	/**
	 * 查询出所有的会员信息
	 * @throws TmsDaoException 
	 */
	@SuppressWarnings("unchecked")
	public List findAllMemberInfo() throws TmsDaoException;
	
	public List findAllMemberInfoM() throws TmsDaoException;
	
	
	/**
	 * 库存统计中载入会员信息
	 * @return
	 * @throws TmsDaoException
	 */
	@SuppressWarnings("unchecked")
	public MemberDto getMember(String memId)throws TmsDaoException;
	
	/**
	 * 
	 * 添加会员信息
	 * @throws TmsDaoException 
	 */
	public void insetMemberInfoByDto(MemberDto dto) throws TmsDaoException;
	/**
	 * 
	 * 获取最大会员ID
	 * @throws TmsDaoException 
	 */
	public int getMaxMemberId() throws TmsDaoException;
	
	/**
	 * 
	 * 查询允许库存登记数量
	 */
	public int findAnnualTransactionVolume(String memberId) throws TmsDaoException;
	
	/**
	 * 
	 * 商户查询/修改列表数据List
	 * @throws TmsDaoException 
	 */
	public List<MemberDto> findMemberInfoList(String memberId,String flag) throws TmsDaoException;	
	/**
	 * 
	 * 商户查询/修改列表数据List
	 * @throws TmsDaoException 
	 */
	public List<MemberDto> findMemberList() throws TmsDaoException;
	/**
	 * 
	 * 查找会员列表  huangwei st2
	 * @throws TmsDaoException 
	 */
	public List<MemberDto> findMemberList(String namePy) throws TmsDaoException;	
	
	/**
	 * 
	 * 
	 * 根据会员ID查询会员基本信息
	 */
	public MemberDto findMemberInfoByMemId(String memberId) throws TmsDaoException;
	/**
	 * 
	 * 根据会员ID更新会员账户信息
	 */
	public void updateAccountInfoByMemId(MemberDto dto) throws TmsDaoException;
	/**
	 * 
	 * 根据会员ID更新会员基本信息
	 */
	public void updateBaseMemberInfoByMemId(MemberDto dto) throws TmsDaoException;
	
	/**
	 * 根据登录ID查询会员基本信息
	 * 
	 */
	public MemberDto findMemberInfoByUserId(String userId) throws TmsDaoException;

	public List<MemberDto> sendSMSMemberList() throws TmsDaoException;
	/**
	 * 
	 * 根据会员ID查询更新时间
	 */
	public int findUpdateTimeByMemberId(String memberId,String inTime) throws TmsDaoException;
	/**
	 * 
	 * 查询会员信息是否存在
	 */
	public int findMemberInfoByMemberId(String memberId) throws TmsDaoException;
	
	/**
	 * 根据MemberId载入登记楼层
	 * @param userId
	 * @return
	 * @throws TmsDaoException
	 */
	public MemberDto loadCarScore(String memberId) throws TmsDaoException;
	/**
	 * 积分管理
	 */
	public MemberDto getIntegralManagementInfo(String accId)throws TmsDaoException;
	
	public void updateIntegralcard(MemberDto dto)throws TmsDaoException;
	public void updateIntegralCardScore(MemberDto dto)throws TmsDaoException;
	public void updateMarginInfo(MemberDto dto)throws TmsDaoException;
	/**
	 * 判断是否有相同的积分卡编号
	 * @param accessCardId
	 * @return
	 * @throws TmsDaoException
	 */
	public int findMemberByAccessCardId(String accessCardId)throws TmsDaoException;
	
	/**
	 * 判断是否有相同的积分卡卡号
	 * @param accessCardNo
	 * @return
	 * @throws TmsDaoException
	 */
	public int findMemberByAccessCardNo(String accessCardNo)throws TmsDaoException;
	
	/**
	 * add by huangwei 20150723
	 * 当前库存量的更新
	 * @param MemberDto
	 * @return
	 * @throws TmsDaoException
	 */
	public void updateUsedCarPort(MemberDto dto,int increment) throws TmsDaoException;
	 
	/**
	 * add by huangwei 20150723
	 * 锁定member单条数据更新
	 * @param memberId
	 * @throws TmsDaoException
	 */
	public void lockMemberForUpdate(int memberId) throws TmsDaoException;
	
	public MemberDto findTransferDataSyn40000(String memberId) throws TmsDaoException;

	/**
	 * 查找商户名称
	 * @param memberName
	 * @param flag
	 * @throws TmsDaoException
	 */
	public List<MemberDto> findMemberNameList(String memberName,int flag)throws TmsDaoException;
	
	/**
	 * 判断商户名是否重复
	 * @param realName
	 * @throws TmsDaoException
	 */
	public boolean isRepeatMemberName(String memberName,int type) throws TmsDaoException;
	/**
	 * 合同编号List的更新
	 * @param MemberDto
	 * @return
	 * @throws TmsDaoException
	 */
	public void updateMemberBusinessNoInfo(MemberDto dto) throws TmsDaoException;
	/**
	 * member信息更新
	 * @param MemberDto
	 * @return
	 * @throws TmsDaoException
	 */
	public void updateMemberInfo(MemberDto dto) throws TmsDaoException;
	/**
	 * member信息更新
	 * @param MemberDto
	 * @return
	 * @throws TmsDaoException
	 */
	public void updateMarginInfoByAccessCardNo(MemberDto dto) throws TmsDaoException;
	/**
	 * 更新会员信息表过户费余额
	 * @param memberId
	 * @param virtualMargin
	 * @return
	 * @throws TmsDaoException
	 */
	public void updateMemberVirtualMargin(String memberId, int virtualMargin)throws TmsDaoException;
	
	/**
	 * 查找推荐权重的用户
	 * @param recommend
	 * @return
	 * @throws TmsDaoException
	 */
	public List<MemberDto> findRecommendMember(int recommend) throws TmsDaoException;
	
	/**
	 * 已登记库存数量查询
	 * @param memberId
	 * @return
	 * @throws TmsDaoException
	 */
	public int findRegistedCount(String memberId) throws TmsDaoException;

	
	 
	public MemberRentalLocationInfo findMemberRentalLocationInfoCount(String serials) throws TmsDaoException;
	
	/**
	 * @param memberId
	 * @return
	 * @throws TmsDaoException
	 */
	public MemberRentalLocationInfo findMemberLocationInfoCount(String serials) throws TmsDaoException;
	
    /**
     * 更新会员信息表过户费余额
     * @param userId
     * @param virtualMargin
     * @return
     * @throws TmsDaoException
     */
    public void updateMemberVirtualMarginByUserId(String userId, int virtualMargin)throws TmsDaoException;
}
